import http from './http';

// 邮箱验证码
export function getEmailCode(email) {
  return http.get('/user/code?' + 'email=' + email)
}
// 注册
export function login(params) {
  return http.post('/admin/login', {
    username: params.username,
    password: params.password
  })
}
export function getContent(params) {
  return http.get('/user/plateDetail?id=' + params.id, {
    id:params.id  
  })
}
// 注册
export function dowxlogin(params) {
  return http.get('/user/wxlogin', {
    code: params.code 
  })
}
// 注册
export function wxRegist(params) {
  return http.post('/user/wxRegist', {
    openid: params.openid, 
    phone: params.phone, 
    headimgurl: params.headimgurl, 
    nickname: params.nickname
  })
}
// 登录
export function sinUp(params) {
  return http.post('/user', {
    name: params.name, 
    username: params.username, 
    email: params.email, 
    code: params.code,
    password: params.password
  })
}
// 忘记密码
export function forgetPass(params) {
  return http.put('/user/forget', {
    username: params.username, 
    email: params.email, 
    code: params.code,
    password: params.password
  })
}
// 修改信息
export function reviseUser(params) {
  return http.put('/user/revise', {
    id: localStorage.getItem("id"),
    name: params.name, 
    username: params.username, 
    phone: params.newphone, 
    email: params.email, 
    code: params.code
  })
}
// 登出
export function logout() {
  return http.get('/admin/logout')
}
// 首页分类
export function getSection() {
  return http.get('/user/section?type=0')
}
// 右侧栏分类
export function getSideSection() {
  return http.get('/user/section?type=1')
}
// 首页文章
export function getPlate(params) {
  return http.get('/user/plate/' + params.page +'/' + params.limit + '?query=' +params.query + '&section=' + params.section)
}
// 右侧栏文章
export function getSidePlate(params) {
  return http.get('/user/plate/1/5?section=' + params.section)
}
// 公司信息
export function getInfo() {
  return http.get('/user/info')
}





